home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / STRSPN.C < prev    next >
Text File  |  1993-01-04  |  640b  |  26 lines

  1.  
  2. /*  File   : strspn.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 11 April 1984
  5.     Defines: strspn()
  6.  
  7.     strspn(s1, s2) returns the  length  of  the  longest  prefix  of  s1
  8.     consisting  entirely  of characters in s2.  NUL is not considered to
  9.     be in s2, and _str2set will not include it in the set.
  10. */
  11.  
  12. #include "strings.h"
  13. #include "_str2set.h"
  14.  
  15. int strspn(str, set)
  16.     register _char_ *str;
  17.     char *set;
  18.     {
  19.         register int L;
  20.  
  21.         _str2set(set);
  22.         for (L = 0; _set_vec[*str++] == _set_ctr; L++) ;
  23.         return L;
  24.     }
  25.  
  26.